Apparatus and method for generating a cryptographic key schedule in a microprocessor

ABSTRACT

An apparatus and method for performing cryptographic operations. In one embodiment, an apparatus is provided for performing cryptographic operations. The apparatus includes fetch logic, keygen logic, and execution logic. The fetch logic is disposed within a microprocessor and receives cryptographic instruction single atomic cryptographic instruction as part of an instruction flow executing on the microprocessor. The cryptographic instruction single atomic cryptographic instruction prescribes one of the cryptographic operations, and also prescribes that a provided cryptographic key be expanded into a corresponding key schedule for employment during execution of the one of the cryptographic operations. The keygen logic is disposed within the microprocessor and is operatively coupled to the single atomic cryptographic instruction. The keygen logic directs the microprocessor to expand the provided cryptographic key into the corresponding key schedule. The execution logic is coupled to the keygen logic. The execution logic is disposed within the microprocessor and expands the provided cryptographic key into the corresponding key schedule.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims the benefit of the following U.S. ProvisionalApplications, which are herein incorporated by reference for all intentsand purposes.

FILING SER. NO. DATE TITLE 60/506,971 Sep. 29, 2003 MICROPROCESSORAPPARATUS (CNTR.2070) AND METHOD FOR OPTIMIZING BLOCK CIPHERCRYPTOGRAPHIC FUNCTIONS 60/507,001 Sep. 29, 2003 APPARATUS AND METHODFOR (CNTR.2071) PERFORMING OPERATING SYSTEM TRANSPARENT BLOCK CIPHERCRYPTOGRAPHIC FUNCTIONS 60/506,978 Sep. 29, 2003 MICROPROCESSORAPPARATUS (CNTR.2072) AND METHOD FOR EMPLOYING CONFIGURABLE BLOCK CIPHERCRYPTOGRAPHIC ALGORITHMS 60/507,004 Sep. 29, 2003 APPARATUS AND METHODFOR (CNTR.2073) PROVIDING USER-GENERATED KEY SCHEDULE IN AMICROPROCESSOR CRYPTOGRAPHIC ENGINE 60/507,002 Sep. 29, 2003MICROPROCESSOR APPARATUS (CNTR.2075) AND METHOD FOR PROVIDINGCONFIGURABLE CRYPTOGRAPHIC BLOCK CIPHER ROUND RESULTS 60/506,991 Sep.29, 2003 MICROPROCESSOR APPARATUS (CNTR.2076) AND METHOD FOR ENABLINGCONFIGURABLE DATA BLOCK SIZE IN A CRYPTOGRAPHIC ENGINE 60/507,003 Sep.29, 2003 APPARATUS FOR ACCELERATING (CNTR.2078) BLOCK CIPHERCRYPTOGRAPHIC FUNCTIONS IN A MICROPROCESSOR 60/464,394 Apr. 18, 2003ADVANCED CRYPTOGRAPHY (CNTR.2222) UNIT 60/506,979 Sep. 29, 2003MICROPROCESSOR APPARATUS (CNTR.2223) AND METHOD FOR PROVIDINGCONFIGURABLE CRYPTOGRAPHIC KEY SIZE 60/508,927 Oct. 3, 2003 APPARATUSAND METHOD FOR (CNTR.2226) PERFORMING OPERATING SYSTEM TRANSPARENTCIPHER BLOCK CHAINING MODE CRYPTOGRAPHIC FUNCTIONS 60/508,679 Oct. 3,2003 APPARATUS AND METHOD FOR (CNTR.2227) PERFORMING OPERATING SYSTEMTRANSPARENT CIPHER FEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 60/508,076 Oct.2, 2003 APPARATUS AND METHOD FOR (CNTR.2228) PERFORMING OPERATING SYSTEMTRANSPARENT OUTPUT FEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 60/508,604 Oct.3, 2003 APPARATUS AND METHOD FOR (CNTR.2230) GENERATING A CRYPTOGRAPHICKEY SCHEDULE IN A MICROPROCESSOR

This application is a continuation-in-part of the following co-pendingU.S. Patent Applications, all of which have a common assignee and commoninventors.

FILING SER. NO. DATE TITLE 10/674,057 Sep. 29, 2003 MICROPROCESSORAPPARATUS (CNTR.2224) AND METHOD FOR PERFORMING BLOCK CIPHERCRYPTOGRAPHIC FUNCTIONS 10/800,983 Mar. 15, 2004 APPARATUS AND METHODFOR (CNTR.2073) PROVIDING USER-GENERATED KEY SCHEDULE IN AMICROPROCESSOR CRYPTOGRAPHIC ENGINE

This application is related to the following co-pending U.S. PatentApplications, all of which have a common assignee and common inventors.

FILING SER. NO. DATE TITLE 10/730,167 Dec. 5, 2003 MICROPROCESSORAPPARATUS (CNTR.2224-C1) AND METHOD FOR PERFORMING BLOCK CIPHERCRYPTOGRAPHIC FUNCTIONS 10/800,768 Mar. 15, 2004 MICROPROCESSORAPPARATUS (CNTR.2070) AND METHOD FOR OPTIMIZING BLOCK CIPHERCRYPTOGRAPHIC FUNCTIONS 10/727,973 Dec. 4, 2003 APPARATUS AND METHOD(CNTR.2071) FOR PERFORMING TRANSPARENT BLOCK CIPHER CRYPTOGRAPHICFUNCTIONS 10/800,938 Mar. 15, 2004 MICROPROCESSOR APPARATUS (CNTR.2072)AND METHOD FOR EMPLOYING CONFIGURABLE BLOCK CIPHER CRYPTOGRAPHICALGORITHMS 10/826,435 HEREWITH MICROPROCESSOR APPARATUS (CNTR.2075) ANDMETHOD FOR PROVIDING CONFIGURABLE CRYPTOGRAPHIC BLOCK CIPHER ROUNDRESULTS 10/826,433 HEREWITH MICROPROCESSOR APPARATUS (CNTR.2076) ANDMETHOD FOR ENABLING CONFIGURABLE DATA BLOCK SIZE IN A CRYPTOGRAPHICENGINE 10/826,475 HEREWITH MICROPROCESSOR APPARATUS (CNTR.2223) ANDMETHOD FOR PROVIDING CONFIGURABLE CRYPTOGRAPHIC KEY SIZE 10/826,814HEREWITH APPARATUS AND METHOD FOR (CNTR.2226) PERFORMING TRANSPARENTCIPHER BLOCK CHAINING MODE CRYPTOGRAPHIC FUNCTIONS 10/826,428 HEREWITHAPPARATUS AND METHOD FOR (CNTR.2227) PERFORMING TRANSPARENT CIPHERFEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 10/826,745 HEREWITH APPARATUS ANDMETHOD FOR (CNTR.2228) PERFORMING TRANSPARENT OUTPUT FEEDBACK MODECRYPTOGRAPHIC FUNCTIONS

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates in general to the field of microelectronics, andmore particularly to an apparatus and method for performingcryptographic operations in a computing device where the computingdevice expands a supplied cryptographic key into a corresponding keyschedule for execution of the cryptographic operations.

2. Description of the Related Art

An early computer system operated independently of other computersystems in the sense that all of the input data required by anapplication program executing on the early computer system was eitherresident on that computer system or was provided by an applicationprogrammer at run time. The application program generated output data asa result of being executed and the output data was generally in the formof a paper printout or a file which was written to a magnetic tapedrive, disk drive, or other type of mass storage device that was part ofthe computer system. The output file could then be used as an input fileto a subsequent application program that was executed on the samecomputer system or, if the output data was previously stored as a fileto a removable or transportable mass storage device, it could then beprovided to a different, yet compatible, computer system to be employedby application programs thereon. On these early systems, the need forprotecting sensitive information was recognized and, among otherinformation security measures, cryptographic application programs weredeveloped and employed to protect the sensitive information fromunauthorized disclosure. These cryptographic programs typicallyscrambled and unscrambled the output data that was stored as files onmass storage devices.

It was not many years thereafter before users began to discover thebenefits of networking computers together to provide shared access toinformation. Consequently, network architectures, operating systems, anddata transmission protocols commensurately evolved to the extent thatthe ability to access shared data was not only supported, butprominently featured. For example, it is commonplace today for a user ofa computer workstation to access files on a different workstation ornetwork file server, or to utilize the Internet to obtain news and otherinformation, or to transmit and receive electronic messages (i.e.,email) to and from hundreds of other computers, or to connect with avendor's computer system and to provide credit card or bankinginformation in order to purchase products from that vendor, or toutilize a wireless network at a restaurant, airport, or other publicsetting to perform any of the aforementioned activities. Therefore, theneed to protect sensitive data and transmissions from unauthorizeddisclosure has grown dramatically. The number of instances during agiven computer session where a user is obliged to protect his or hersensitive data has substantially increased. Current news headlinesregularly force computer information security issues such as spam,hacking, identity theft, reverse engineering, spoofing, and credit cardfraud to the forefront of public concern. And since the motivation forthese invasions of privacy range all the way from innocent mistakes topremeditated cyber terrorism, responsible agencies have responded withnew laws, stringent enforcement, and public education programs. Yet,none of these responses has proved to be effective at stemming the tideof computer information compromise. Consequently, what was once theexclusive concern of governments, financial institutions, the military,and spies has now become a significant issue for the average citizen whoreads their email or accesses their checking account transactions fromtheir home computer. On the business front, one skilled in the art willappreciate that corporations from small to large presently devote aremarkable portion of their resources to the protection of proprietaryinformation.

The field of information security that provides us with techniques andmeans to encode data so that it can only be decoded by specifiedindividuals is known as cryptography. When particularly applied toprotecting information that is stored on or transmitted betweencomputers, cryptography most often is utilized to transform sensitiveinformation (known in the art as “plaintext” or “cleartext”) into anunintelligible form (known in the art as “ciphertext”). Thetransformation process of converting plaintext into ciphertext is called“encryption,” “enciphering,” or “ciphering” and the reversetransformation process of converting ciphertext back into plaintext isreferred to as “decryption,” “deciphering,” or “inverse ciphering.”

Within the field of cryptography, several procedures and protocols havebeen developed that allow for users to perform cryptographic operationswithout requiring great knowledge or effort and for those users to beable to transmit or otherwise provide their information products inencrypted forms to different users. Along with encrypted information, asending user typically provides a recipient user with a “cryptographickey” that enables the recipient user to decipher the encryptedinformation thus enabling the recipient user to recover or otherwisegain access to the unencrypted original information. One skilled in theart will appreciate that these procedures and protocols generally takethe form of password protection, mathematical algorithms, andapplication programs specifically designed to encrypt and decryptsensitive information.

Several classes of algorithms are currently used to encrypt and decryptdata. Algorithms according to one such class (i.e., public keycryptographic algorithms, an instance of which is the Rivest, Shamir,Adlemen (RSA) algorithm) employ two cryptographic keys, a public key anda private key, to encrypt or decrypt data. According to some of thepublic key algorithms, a recipient's public key is employed by a senderto encrypt data for transmission to the recipient. Because there is amathematical relationship between a user's public and private keys, therecipient must employ his private key to decrypt the transmission inorder to recover the data. Although this class of cryptographicalgorithms enjoys widespread use today, encryption and decryptionoperations are exceedingly slow even on small amounts of data. A secondclass of algorithms, known as symmetric key algorithms, providecommensurate levels of data security and can be executed much faster.These algorithms are called symmetric key algorithms because they use asingle cryptographic key to both encrypt and decrypt information. In thepublic sector, there are currently three prevailing single-keycryptographic algorithms: the Data Encryption Standard (DES), TripleDES, and the Advanced Encryption Standard (AES). Because of the strengthof these algorithms to protect sensitive data, they are used now by U.S.Government agencies, but it is anticipated by those in the art that oneor more of these algorithms will become the standard for commercial andprivate transactions in the near future. According to all of thesesymmetric key algorithms, plaintext and ciphertext is divided intoblocks of a specified size for encryption and decryption. For example,AES performs cryptographic operations on blocks 128 bits in size, anduses cryptographic key sizes of 128-, 192-, and 256-bits. Othersymmetric key algorithms such as the Rijndael Cipher allow for 192- and256-bit data blocks as well. Accordingly, for a block encryptionoperation, a 1024-bit plaintext message is encrypted as eight 128-bitblocks.

All of the symmetric key algorithms utilize the same type ofsub-operations to encrypt a block of plaintext. And according to many ofthe more commonly employed symmetric key algorithms, an initialcryptographic key is expanded into a plurality of keys (i.e., a “keyschedule”), each of which is employed as a corresponding cryptographic“round” of sub-operations is performed on the block of plaintext. Forinstance, a first key from the key schedule is used to perform a firstcryptographic round of sub-operations on the block of plaintext. Theresult of the first round is used as input to a second round, where thesecond round employs a second key from the key schedule to produce asecond result. And a specified number of subsequent rounds are performedto yield a final round result which is the ciphertext itself. Accordingto the AES algorithm, the sub-operations within each round are referredto in the literature as SubBytes (or S-box), ShiftRows, MixColums, andAddRoundKey. Decryption of a block of ciphertext is similarlyaccomplished with the exceptions that the ciphertext is the input to theinverse cipher and inverse sub-operations are performed (e.g., InverseMixColumns, Inverse ShiftRows) during each of the rounds, and the finalresult of the rounds is a block of plaintext.

DES and Triple-DES utilize different specific sub-operations, but thesub-operations are analogous to those of AES because they are employedin a similar fashion to transform a block of plaintext into a block ofciphertext.

To perform cryptographic operations on multiple successive blocks oftext, all of the symmetric key algorithms employ the same types ofmodes. These modes include electronic code book (ECB) mode, cipher blockchaining (CBC) mode, cipher feedback (CFB) mode, and output feedback(OFB) mode. Some of these modes utilize an additional initializationvector during performance of the sub-operations and some use theciphertext output of a first set of cryptographic rounds performed on afirst block of plaintext as an additional input to a second set ofcryptographic rounds performed on a second block of plaintext. It isbeyond the scope of the present application to provide an in depthdiscussion of each of the cryptographic algorithms and sub-operationsemployed by present day symmetric key cryptographic algorithms. Forspecific implementation standards, the reader is directed to FederalInformation Processing Standards Publication 46-3 (FIPS-46-3), datedOct. 25, 1999 for a detailed discussion of DES and Triple DES, andFederal Information Processing Standards Publication 197 (FIPS-197),dated Nov. 26, 2001 for a detailed discussion of AES. Both of theaforementioned standards are issued and maintained by the NationalInstitute of Standards and Technology (NIST) and are herein incorporatedby reference for all intents and purposes. In addition to theaforementioned standards, tutorials, white papers, toolkits, andresource articles can be obtained from NIST's Computer Security ResourceCenter (CSRC) over the Internet.

One skilled in the art will appreciate that there are numerousapplication programs available for execution on a computer system thatcan perform cryptographic operations (i.e., encryption and decryption).In fact, some operating systems (e.g. Microsoft® WindowsXP®, LINUX®)provide direct encryption/decryption services in the form ofcryptographic primitives, cryptographic application program interfaces,and the like. The present inventors, however, have observed that presentday computer cryptography techniques are deficient in several respects.Thus, the reader's attention is directed to FIG. 1, whereby thesedeficiencies are highlighted and discussed below.

FIG. 1 is a block diagram 100 illustrating present day computercryptography applications. The block diagram 100 depicts a firstcomputer workstation 101 connected to a local area network 105. Alsoconnected to the network 105 is a second computer workstation 102, anetwork file storage device 106, a first router 107 or other form ofinterface to a wide area network (WAN) 110 such as the Internet, and awireless network router 108 such as one of those compliant withInstitute of Electrical and Electronics Engineers (IEEE) Standard802.11. A laptop computer 104 interfaces to the wireless router 108 overa wireless network 109. At another point on the wide area network 110, asecond router 111 provides interface for a third computer workstation103.

As alluded to above, a present day user is confronted with the issue ofcomputer information security many times during a work session. Forexample, under the control of a present day multi-tasking operatingsystem, a user of workstation 101 can be performing several simultaneoustasks, each of which require cryptographic operations. The user ofworkstation 101 is required to run an encryption/decryption application112 (either provided as part of the operating system or invoked by theoperating system) to store a local file on the network file storagedevice 106. Concurrent with the file storage, the user can transmit anencrypted message to a second user at workstation 102, which alsorequires executing an instance of the encryption/decryption application112. The encrypted message may be real-time (e.g., an instant message)or non-real-time (i.e. email). In addition, the user can be accessing orproviding his/her financial data (e.g., credit card numbers, financialtransactions, etc.) or other forms of sensitive data over the WAN 110from workstation 103. Workstation 103 could also represent a home officeor other remote computer 103 that the user of workstation 101 employswhen out of the office to access any of the shared resources 101, 102,106 107, 108, 109 on local area network 105. Each of theseaforementioned activities requires that a corresponding instance of theencryption/decryption application 112 be invoked. Furthermore, wirelessnetworks 109 are now being routinely provided in coffee shops, airports,schools, and other public venues, thus prompting a need for a user oflaptop 104 to encrypt/decrypt not only his/her messages to/from otherusers, but to encrypt and decrypt all communications over the wirelessnetwork 109 to the wireless router 108.

One skilled in the art will therefore appreciate that along with eachactivity that requires cryptographic operations at a given workstation101-104, there is a corresponding requirement to invoke an instance ofthe encryption/decryption application 112. Hence, a computer 101-104 inthe near future could potentially be performing hundreds of concurrentcryptographic operations.

The present inventors have noted several limitations to the aboveapproach of performing cryptographic operations by invoking one or moreinstances of an encryption/decryption application 112 on a computingsystem 101-104. For example, performing a prescribed function viaprogrammed software is exceedingly slow compared to performing that samefunction via dedicated hardware. Each time the encryption/decryptionapplication 112 is required, a current task executing on a computer101-104 must be suspended from execution, and parameters of thecryptographic operation (i.e., plaintext, ciphertext, mode, key, etc.)must be passed through the operating system to the instance of theencryption/decryption application 112, which is invoked foraccomplishment of the cryptographic operation. And because cryptographicalgorithms necessarily involve many rounds of sub-operations on aparticular block of data, execution of the encryption/decryptionapplications 112 involves the execution of numerous computerinstructions to the extent that overall system processing speed isdisadvantageously affected. One skilled in the art will appreciate thatsending a small encrypted email message in Microsoft® Outlook® can takeup to five times as long as sending an unencrypted email message.

In addition, current techniques are limited because of the delaysassociated with operating system intervention. Most application programsdo not provide integral key generation or encryption/decryptioncomponents; they employ components of the operating system or plug-inapplications to accomplish these tasks. And operating systems areotherwise distracted by interrupts and the demands of other currentlyexecuting application programs.

Furthermore, the present inventors have noted that the accomplishment ofcryptographic operations on a present day computer system 101-104 isvery much analogous to the accomplishment of floating point mathematicaloperations prior to the advent of dedicated floating point units withinmicroprocessors. Early floating point operations were performed viasoftware and hence, they executed very slowly. Like floating pointoperations, cryptographic operations performed via software aredisagreeably slow. As floating point technology evolved further,floating point instructions were provided for execution on floatingpoint co-processors. These floating point co-processors executedfloating point operations much faster than software implementations, yetthey added cost to a system. Likewise, cryptographic co-processors existtoday in the form of add-on boards or external devices that interface toa host processor via parallel ports or other interface buses (e.g.,Universal Serial Bus (USB)). These co-processors certainly enable theaccomplishment of cryptographic operations much faster than puresoftware implementations. But cryptographic co-processors add cost to asystem configuration, require extra power, and decrease the overallreliability of a system. Cryptographic co-processor implementations areadditionally vulnerable to snooping because the data channel is not onthe same die as the host microprocessor.

Therefore, the present inventors recognize a need for dedicatedcryptographic hardware within a present day microprocessor such that anapplication program that requires a cryptographic operation can directthe microprocessor to perform the cryptographic operation via a single,atomic, cryptographic instruction. The present inventors also recognizethat such a capability should be provided so as to limit requirementsfor operating system intervention and management. Also, it is desirablethat the cryptographic instruction be available for use at anapplication program's privilege level and that the dedicatedcryptographic hardware comport with prevailing architectures of presentday microprocessors. There is also a need to provide the cryptographichardware and associated cryptographic instruction in a manner thatsupports compatibility with legacy operating systems and applications.It is moreover desirable to provide an apparatus and method forperforming cryptographic operations that is resistant to unauthorizedobservation, that can support and is programmable with respect tomultiple cryptographic algorithms, that supports verification andtesting of the particular cryptographic algorithm that is embodiedthereon, that allows for user-provided cryptographic keys as well asself-generated cryptographic keys, that supports multiple data blocksizes and multiple cryptographic key sizes, and that provides forprogrammable block encryption/decryption modes such as ECB, CBC, CFB,and OFB.

SUMMARY OF THE INVENTION

The present invention, among other applications, is directed to solvingthese and other problems and disadvantages of the prior art. The presentinvention provides a superior technique for performing cryptographicoperations within a microprocessor. In one embodiment, an apparatus isprovided for performing cryptographic operations. The apparatus includesfetch logic, translation logic, keygen logic, and execution logic. Thefetch logic receives a cryptographic instruction single atomiccryptographic instruction as part of an instruction flow executing onthe microprocessor. The cryptographic single atomic cryptographicinstruction prescribes one of the cryptographic operations, and alsoprescribes that a provided cryptographic key be expanded into acorresponding key schedule for employment during execution of the one ofthe cryptographic operations. The translation logic is coupled to thefetch logic, and is configured to translate the single atomiccryptographic instruction into a sequence of micro instructions thatdirects the microprocessor to perform the one of the cryptographicoperations. The keygen logic is disposed within the microprocessor andis operatively coupled to the single atomic cryptographic instruction.The keygen logic directs the microprocessor to expand the providedcryptographic key into the corresponding key schedule. The executionlogic disposed within the microprocessor and is coupled to the keygenlogic. The execution logic expands the provided cryptographic key intothe corresponding key schedule. The execution logic includes acryptography unit that executes a plurality of cryptographic rounds oneach of the plurality of input text blocks to generate a correspondingeach of a plurality of output text blocks, where the plurality ofcryptographic rounds are prescribed by a control word that is providedto the cryptography unit.

One aspect of the present invention contemplates an apparatus forperforming cryptographic operations. The apparatus has a cryptographyunit disposed within execution logic in a microprocessor and keygenlogic. The cryptography unit executes one of the cryptographicoperations responsive to receipt of a cryptographic single atomiccryptographic instruction by the microprocessor within an instructionflow that prescribes the one of the cryptographic operations, where thecryptographic instruction single atomic cryptographic instruction isfetched from memory by fetch logic in the microprocessor, and where thesingle atomic cryptographic instruction also prescribes that acryptographic key be expanded into a corresponding key schedule beemployed when executing the one of the cryptographic operations.Translation logic in the microprocessor translates the single atomiccryptographic instruction into a sequence of micro instructions thatdirects the microprocessor to perform the one of the cryptographicoperations. The keygen logic is operatively coupled to the cryptographyunit. The keygen logic directs the microprocessor to perform the one ofthe cryptographic operations and to expand the cryptographic key intothe corresponding key schedule.

Another aspect of the present invention provides a method for performingcryptographic operations. The method includes, within a microprocessor,fetching a cryptographic instruction single atomic cryptographicinstruction from memory that prescribes expansion of a cryptographic keyinto a corresponding key schedule for employment during execution of oneof a plurality of cryptographic operations, and translating the singleatomic cryptographic instruction into a sequence of micro instructionsthat direct the microprocessor to perform the one of the plurality ofcryptographic operations; and via a cryptography unit disposed withinexecution logic in the microprocessor, expanding the cryptographic keyinto the corresponding key schedule.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other objects, features, and advantages of the presentinvention will become better understood with regard to the followingdescription, and accompanying drawings where:

FIG. 1 is a block diagram illustrating present day cryptographyapplications;

FIG. 2 is a block diagram depicting techniques for performingcryptographic operations;

FIG. 3 is a block diagram featuring a microprocessor apparatus accordingto the present invention for performing cryptographic operations;

FIG. 4 is a block diagram showing one embodiment of an atomiccryptographic instruction according to the present invention;

FIG. 5 is a table illustrating exemplary block cipher mode field valuesaccording to the atomic cryptographic instruction of FIG. 4;

FIG. 6 is a block diagram detailing a cryptography unit within anx86-compatible microprocessor according to the present invention;

FIG. 7 is a diagram illustrating fields within an exemplary microinstruction for directing cryptographic sub-operations within themicroprocessor of FIG. 6;

FIG. 8 is a table depicting values of the register field for an XLOADmicro instruction according to the format of FIG. 7;

FIG. 9 is a table showing values of the register field for an XSTORmicro instruction according to the format of FIG. 7;

FIG. 10 is diagram highlighting an exemplary control word format forprescribing cryptographic parameters of a cryptography operationaccording to the present invention;

FIG. 11 is a table depicting values of the KGEN field for a control wordaccording to FIG. 10;

FIG. 12 is a block diagram featuring details of an exemplarycryptography unit according to the present invention;

FIG. 13 is a block diagram illustrating an embodiment of block cipherlogic according to the present invention for performing cryptographicoperations in accordance with the Advanced Encryption Standard (AES)algorithm;

FIG. 14 is a block diagram showing an exemplary AES embodiment of128-bit cryptographic key expansion logic according to the presentinvention;

FIG. 15 is a flow chart featuring a method according to the presentinvention for preserving the state of cryptographic parameters during aninterrupting event; and

FIG. 16 is a flow chart depicting a method according to the presentinvention for expanding a cryptographic key into a corresponding keyschedule for performing a cryptographic operation on a plurality ofinput data blocks in the presence of one or more interrupting events.

DETAILED DESCRIPTION

The following description is presented to enable one of ordinary skillin the art to make and use the present invention as provided within thecontext of a particular application and its requirements. Variousmodifications to the preferred embodiment will, however, be apparent toone skilled in the art, and the general principles defined herein may beapplied to other embodiments. Therefore, the present invention is notintended to be limited to the particular embodiments shown and describedherein, but is to be accorded the widest scope consistent with theprinciples and novel features herein disclosed.

In view of the above background discussion on cryptographic operationsand associated techniques employed within present day computer systemsto encrypt and decrypt data, the discussion of these techniques andtheir limitations will now be continued with reference to FIG. 2.Following this, the present invention will be discussed with referenceto FIGS. 3-16. The present invention provides an apparatus and methodfor performing cryptographic operations in a present day computer systemthat exhibits superior performance characteristics over prevailingmechanisms and furthermore satisfies the above noted goals of limitingoperating system intervention, atomicity, legacy and architecturalcompatibility, algorithmic and mode programmability, self-generation ofcryptographic key schedules, hack resistance, and testability.

Now turning to FIG. 2, a block diagram 200 is presented depictingtechniques for performing cryptographic operations in a present daycomputer system as discussed above. The block diagram 200 includes amicroprocessor 201 that fetches instructions and accesses dataassociated with an application program from an area of system memorycalled application memory 203. Program control and access of data withinthe application memory 203 is generally managed by operating systemsoftware 202 that resides in a protected area of system memory. Asdiscussed above, if an executing application program (e.g., an emailprogram or a file storage program) requires that a cryptographicoperation be performed, the executing application program mustaccomplish the cryptographic operation by directing the microprocessor201 to execute a significant number of instructions. These instructionsmay be subroutines that are part of the executing application programitself, they may be plug-in applications that are linked to theexecution application program, or they may be services that are providedby the operating system 202. Regardless of their association, oneskilled in the art will appreciate that the instructions will reside insome designated or allocated area of memory. For purposes of discussion,these areas of memory are shown within the application memory 203 andcomprise a cryptographic key generation application 204 that typicallygenerates or accepts a cryptographic key and expands the key into a keyschedule 205 for use in cryptographic round operations. For amulti-block encryption operation, a block encryption application 206 isinvoked. The encryption application 206 executes instructions thataccess blocks of plaintext 210, the key schedule 205, cryptographicparameters 209 that further specify particulars of the encryptionoperation such as mode, location of the key schedule, etc. If requiredby specified mode, an initialization vector 208 is also accessed by theencryption application 206. The encryption application 206 executes theinstructions therein to generate corresponding blocks of ciphertext 211.Similarly, a block decryption application 207 is invoked for performingblock decryption operations. The decryption application 207 executesinstructions that access blocks of ciphertext 211, the key schedule 205,cryptographic parameters 209 that further specify particulars of theblock decryption operation and, if mode requires, an initializationvector 208 is also accessed. The decryption application 207 executes theinstructions therein to generate corresponding blocks of plaintext 210.

It is noteworthy that a significant number of instructions must beexecuted in order to generate cryptographic keys and to encrypt ordecrypt blocks of text. The aforementioned FIPS specifications containmany examples of pseudo code enabling the approximate number ofinstructions that are required to be estimated, therefore, one skilledin the art will appreciate that hundreds of instructions are required toaccomplish a simple block encryption operation. And each of theseinstructions must be executed by the microprocessor 201 in order toaccomplish the requested cryptographic operation. Furthermore, theexecution of instructions to perform a cryptographic operation isgenerally seen as superfluous to the primary purposes (e.g., filemanagement, instant messaging, email, remote file access, credit cardtransaction) of a currently executing application program. Consequently,a user of the currently executing application program senses that thecurrently executing application is performing inefficiently. In the caseof stand-alone or plug-in encryption and decryption applications 206,207, invocation and management of these applications 206, 207 must alsobe subject to the other demands of the operating system 202 such assupporting interrupts, exceptions, and like events that furtherexacerbate the problem. Moreover, for every concurrent cryptographicoperation that is required on a computer system, a separate instance ofthe applications 204, 206, 207 must be allocated in memory 203. And, asnoted above, it is anticipated that the number of concurrentcryptographic operations required to be performed by a microprocessor201 will continue to increase with time.

The present inventors have noted the problems and limitations of currentcomputer system cryptographic techniques and furthermore recognize aneed to provide apparatus and methods for performing cryptographicoperations in a microprocessor which do not exhibit disadvantageousprogram delays to users. Accordingly, the present invention provides amicroprocessor apparatus and associated methodology for performingcryptographic operations via a dedicated cryptographic unit therein. Thecryptographic unit is activated to perform cryptographic operations viaprogramming of a single cryptographic instruction. The present inventionwill now be discussed with reference to FIGS. 3-16.

Referring to FIG. 3, a block diagram 300 is provided featuring amicroprocessor apparatus according to the present invention forperforming cryptographic operations. The block diagram 300 depicts amicroprocessor 301 that is coupled to a system memory 321 via a memorybus 319. The microprocessor 301 includes translation logic 303 thatreceives instructions from an instruction register 302. The translationlogic 303 comprises logic, circuits, devices, or microcode (i.e., microinstructions or native instructions), or a combination of logic,circuits, devices, or microcode, or equivalent elements that areemployed to translate instructions into associated sequences of microinstructions. The elements employed to perform translation within thetranslation logic 303 may be shared with other circuits, microcode,etc., that are employed to perform other functions within themicroprocessor 301. According to the scope of the present application,microcode is a term employed to refer to one or more micro instructions.A micro instruction (also referred to as a native instruction) is aninstruction at the level that a unit executes. For example, microinstructions are directly executed by a reduced instruction set computer(RISC) microprocessor. For a complex instruction set computer (CISC)microprocessor such as an x86-compatible microprocessor, x86instructions are translated into associated micro instructions, and theassociated micro instructions are directly executed by a unit or unitswithin the CISC microprocessor. The translation logic 303 is coupled toa micro instruction queue 304. The micro instruction queue 304 has aplurality of micro instruction entries 305, 306. Micro instructions areprovided from the micro instruction queue 304 to register stage logicthat includes a register file 307. The register file 307 has a pluralityof registers 308-313 whose contents are established prior to performinga prescribed cryptographic operation. Registers 308-312 point tocorresponding locations 323-327 in memory 321 that contain data which isrequired to perform the prescribed cryptographic operation. The registerstage is coupled to load logic 314, which interfaces to a data cache 315for retrieval of data for performance of the prescribed cryptographicoperation. The data cache 315 is coupled to the memory 321 via thememory bus 319. Execution logic 328 is coupled to the load logic 314 andexecutes the operations prescribed by micro instructions as passed downfrom previous stages. The execution logic 328 comprises logic, circuits,devices, or microcode (i.e., micro instructions or native instructions),or a combination of logic, circuits, devices, or microcode, orequivalent elements that are employed to perform operations asprescribed by instructions provided thereto. The elements employed toperform the operations within the execution logic 328 may be shared withother circuits, microcode, etc., that are employed to perform otherfunctions within the microprocessor 301. The execution logic 328includes a cryptography unit 316. The cryptography unit 316 receivesdata required to perform the prescribed cryptographic operation from theload logic 314. Micro instructions direct the cryptography unit 316 toperform the prescribed cryptographic operation on a plurality of blocksof input text 326 to generate a corresponding plurality of blocks ofoutput text 327. The cryptography unit 316 comprises logic, circuits,devices, or microcode (i.e., micro instructions or native instructions),or a combination of logic, circuits, devices, or microcode, orequivalent elements that are employed to perform cryptographicoperations. The elements employed to perform the cryptographicoperations within the cryptography unit 316 may be shared with othercircuits, microcode, etc., that are employed to perform other functionswithin the microprocessor 301. In one embodiment, the cryptography unit316 operates in parallel to other execution units (not shown) within theexecution logic 328 such as an integer unit, floating point unit, etc.One embodiment of a “unit” within the scope of the present applicationcomprises logic, circuits, devices, or microcode (i.e., microinstructions or native instructions), or a combination of logic,circuits, devices, or microcode, or equivalent elements that areemployed to perform specified functions or specified operations. Theelements employed to perform the specified functions or specifiedoperations within a particular unit may be shared with other circuits,microcode, etc., that are employed to perform other functions oroperations within the microprocessor 301. For example, in oneembodiment, an integer unit comprises logic, circuits, devices, ormicrocode (i.e., micro instructions or native instructions), or acombination of logic, circuits, devices, or microcode, or equivalentelements that are employed to execute integer instructions. A floatingpoint unit comprises logic, circuits, devices, or microcode (i.e., microinstructions or native instructions), or a combination of logic,circuits, devices, or microcode, or equivalent elements that areemployed to execute floating point instructions. The elements employedexecute integer instructions within the integer unit may be shared withother circuits, microcode, etc., that are employed to execute floatingpoint instructions within the floating point unit. In one embodimentthat is compatible with the x86 architecture, the cryptography unit 316operates in parallel with an x86 integer unit, an x86 floating pointunit, an x86 MMX® unit, and an x86 SSE® unit. According to the scope ofthe present application, an embodiment is compatible with the x86architecture if the embodiment can correctly execute a majority of theapplication programs that are designed to be executed on an x86microprocessor. An application program is correctly executed if itsexpected results are obtained. Alternative x86-compatible embodimentscontemplate the cryptography unit operating in parallel with a subset ofthe aforementioned x86 execution units. The cryptography unit 316 iscoupled to store logic 317 and provides the corresponding plurality ofblocks of output text 327. The store logic 317 is also coupled to thedata cache 315, which routes the output text data 327 to system memory321 for storage. The store logic 317 is coupled to write back logic 318.The write back logic 318 updates registers 308-313 within the registerfile 307 as the prescribed cryptographic operation is accomplished. Inone embodiment, micro instructions flow through each of theaforementioned logic stages 302, 303, 304, 307, 314, 316-318 insynchronization with a clock signal (not shown) so that operations canbe concurrently executed in a manner substantially similar to operationsperformed on an assembly line.

Within the system memory 321, an application program that requires theprescribed cryptographic operation can direct the microprocessor 301 toperform the operation via a single cryptographic instruction 322,referred to herein for instructive purposes as an XCRYPT instruction322. In a CISC embodiment, the XCRYPT instruction 322 comprises aninstruction that prescribes a cryptographic operation. In a RISCembodiment, the XCRYPT instruction 322 comprises a micro instructionthat prescribes a cryptographic operation. In one embodiment, the XCRYPTinstruction 322 utilizes a spare or otherwise unused instruction opcodewithin an existing instruction set architecture. In one x86-compatibleembodiment, the XCRYPT instruction 322 is a 4-byte instructioncomprising an x86 REP prefix (i.e., 0xF3), followed by unused x86 2-byteopcode (e.g., 0x0FA7), followed a byte detailing a specific block ciphermode to be employed during execution of a prescribed cryptographicoperation. In one embodiment, the XCRPYT instruction 322 according tothe present invention can be executed at the level of system privilegesafforded to application programs and can thus be programmed into aprogram flow of instructions that are provided to the microprocessor 301either directly by an application program or under control of anoperating system 320. Since there is only one instruction 322 that isrequired to direct the microprocessor 301 to perform the prescribedcryptographic operation, it is contemplated that accomplishment of theoperation is entirely transparent to the operating system 320.

In operation, the operating system 320 invokes an application program toexecute on the microprocessor 301. As part of the flow of instructionsduring execution of the application program, an XCRYPT instruction 322is provided from memory 321 to the fetch logic 302. Prior to executionof the XCRYPT instruction 322, however, instructions within the programflow direct the microprocessor 301 to initialize the contents ofregisters 308-312 so that they point to locations 323-327 in memory 321that contain a cryptographic control word 323, an initial cryptographickey 324 or a key schedule 324, an initialization vector 325 (ifrequired), input text 326 for the operation, and output text 327. It isrequired to initialize the registers 308-312 prior to executing theXCRYPT instruction 322 because the XCRYPT instruction 322 implicitlyreferences the registers 308-312 along with an additional register 313that contains a block count, that is the number of blocks of data withinthe input text area 326 to be encrypted or decrypted. Thus, thetranslation logic 303 retrieves the XCRYPT instruction from the fetchlogic 30.2 and translates it into a corresponding sequence of microinstructions that directs the microprocessor 301 to perform theprescribed cryptographic operation. A first plurality of microinstructions 305-306 within the corresponding sequence of microinstructions specifically directs the cryptography unit 316 to load dataprovided from the load logic 314 and to begin execution of a prescribednumber of cryptographic rounds to generate a corresponding block ofoutput data and to provide the corresponding block of output data to thestore logic 317 for storage in the output text area 327 of memory 321via the data cache 315. A second plurality of micro instructions (notshown) within the corresponding sequence of micro instructions directsother execution units (not shown) within the microprocessor 301 toperform other operations necessary to accomplish the prescribedcryptographic operation such as management of non-architecturalregisters (not shown) that contain temporary results and counters,update of input and output pointer registers 311-312, update of theinitialization vector pointer register 310 (if required) followingencryption/decryption of a block of input text 326, processing ofpending interrupts, etc. In one embodiment, registers 308-313 arearchitectural registers. An architectural register 308-313 is a registerthat is defined within the instruction set architecture (ISA) for theparticular microprocessor that is implemented.

In one embodiment, the cryptography unit 316 is divided into a pluralityof stages thus allowing for pipelining of successive input text blocks326.

The block diagram 300 of FIG. 3 is provided to teach the necessaryelements of the present invention and thus, much of the logic within apresent day microprocessor 301 has been omitted from the block diagram300 for clarity purposes. One skilled in the art will appreciate,however, that a present day microprocessor 301 comprises many stages andlogic elements according to specific implementation, some of which havebeen aggregated herein for clarity purposes. For instance, the loadlogic 314 could embody an address generation stage followed by a cacheinterface stage, following by a cache line alignment stage. What isimportant to note, however, is that a complete cryptographic operationon a plurality of blocks of input text 326 is directed according to thepresent invention via a single instruction 322 whose operation isotherwise transparent to considerations of the operating system 320 andwhose execution is accomplished via a dedicated cryptography unit 316that operates in parallel with and in concert with other execution unitswithin the microprocessor 301. The present inventors contemplateprovision of alternative embodiments of the cryptography unit 316 inembodiment configurations that are analogous to provision of dedicatedfloating point unit hardware within a microprocessor in former years.Operation of the cryptography unit 316 and associated XCRPYT instruction322 is entirely compatible with the concurrent operation of legacyoperating systems 320 and applications, as will be described in moredetail below.

Now referring to FIG. 4, a block diagram is provided showing oneembodiment of an atomic cryptographic instruction 400 according to thepresent invention. The cryptographic instruction 400 includes anoptional prefix field 401, which is followed by a repeat prefix field402, which is followed by an opcode field 403, which is followed by ablock cipher mode field 404. In one embodiment, contents of the fields401-404 comport with the x86 instruction set architecture. Alternativeembodiments contemplate compatibility with other instruction setarchitectures.

Operationally, the optional prefix 401 is employed in many instructionset architectures to enable or disable certain processing features of ahost microprocessor such as directing 16-bit or 32-bit operations,directing processing or access to specific memory segments, etc. Therepeat prefix 402 indicates that the cryptographic operation prescribedby the cryptographic instruction 400 is to be accomplished on aplurality of blocks of input data (i.e., plaintext or ciphertext). Therepeat prefix 402 also implicitly directs a comporting microprocessor toemploy the contents of a plurality of architectural registers therein aspointers to locations in system memory that contain cryptographic dataand parameters needed to accomplish the specified cryptographicoperation. As noted above, in an x86-compatible embodiment, the value ofthe repeat prefix 402 is 0xF3. And, according to x86 architecturalprotocol, the cryptographic instruction is very similar in form to anx86 repeat string instruction such as REP.MOVS. For example, whenexecuted by an x86-compatible microprocessor embodiment of the presentinvention, the repeat prefix implicitly references a block countvariable that is stored in architectural register ECX, a source addresspointer (pointing to the input data for the cryptographic operation)that is stored in register ESI, and a destination address pointer(pointing to the output data area in memory) that is stored in registerEDI. In an x86-compatible embodiment, the present invention furtherextends the conventional repeat-string instruction concept to furtherreference a control word pointer that is stored in register EDX, acryptographic key pointer that is stored in register EBX, and a pointerto an initialization vector (if required by prescribed cipher mode) thatis stored in register EAX.

The opcode field 403 prescribes that the microprocessor accomplish acryptographic operation as further specified within a control wordstored in memory that is implicitly referenced via the control wordpointer. The present invention contemplates preferred choice of theopcode value 403 as one of the spare or unused opcode values within anexisting instruction set architecture so as to preserve compatibilitywithin a conforming microprocessor with legacy operating system andapplication software. For example, as noted above, an x86-compatibleembodiment of the opcode field 403 employs value 0x0FA7 to directexecution of the specified cryptographic operation. The block ciphermode field 404 prescribes the particular block cipher mode to beemployed during the specified cryptographic operation, as will now bediscussed with reference to FIG. 5.

FIG. 5 is a table 500 illustrating exemplary block cipher mode fieldvalues according to the atomic cryptographic instruction of FIG. 4.Value 0xC8 prescribes that the cryptographic operation be accomplishedusing electronic code book (ECB) mode. Value 0xD0 prescribes that thecryptographic operation be accomplished using cipher block chaining(CBC) mode. Value 0xE0 prescribes that the cryptographic operation beaccomplished using cipher feedback (CFB) mode. And value 0xE8 prescribesthat the cryptographic operation be accomplished using output feedback(OFB) mode. All other values of the block cipher mode field 404 arereserved. These modes are described in the aforementioned FIPSdocuments.

Now turning to FIG. 6, a block diagram is presented detailing acryptography unit 617 within an x86-compatible microprocessor 600according to the present invention. The microprocessor 600 includesfetch logic 601 that fetches instructions from memory (not shown) forexecution. The fetch logic 601 is coupled to translation logic 602. Thetranslation logic 602 comprises logic, circuits, devices, or microcode(i.e., micro instructions or native instructions), or a combination oflogic, circuits, devices, or microcode, or equivalent elements that areemployed to translate instructions into associated sequences of microinstructions. The elements employed to perform translation within thetranslation logic 602 may be shared with other circuits, microcode,etc., that are employed to perform other functions within themicroprocessor 600. The translation logic 602 includes keygen logic 640that is coupled to a translator 603 and a microcode ROM 604. Interruptlogic 626 couples to the translation logic 602 via bus 628. A pluralityof software and hardware interrupt signals 627 are processed by theinterrupt logic 626 which indicates pending interrupts to thetranslation logic 628. The translation logic 602 is coupled tosuccessive stages of the microprocessor 600 including a register stage605, address stage 606, load stage 607, execute stage 608, store stage618, and write back stage 619. Each of the successive stages includelogic to accomplish particular functions related to the execution ofinstructions that are provided by the fetch logic 601 as has beenpreviously discussed with reference like-named elements in themicroprocessor of FIG. 3. The exemplary x86-compatible embodiment 600depicted in FIG. 6 features execution logic 632 within the execute stage608 that includes parallel execution units 610, 612, 614, 616, 617. Aninteger unit 610 receives integer micro instructions for execution frommicro instruction queue 609. A floating point unit 612 receives floatingpoint micro instructions for execution from micro instruction queue 611.An MMX® unit 614 receives MMX micro instructions for execution frommicro instruction queue 613. An SSE® unit 616 receives SSE microinstructions for execution from micro instruction queue 615. In theexemplary x86 embodiment shown, a cryptography unit 617 is coupled tothe SSE unit 616 via a load bus 620, a stall signal 621, and a store bus622. The cryptography unit 617 shares the SSE unit's micro instructionqueue 615. An alternative embodiment contemplates stand-alone paralleloperation of the cryptography unit 617 in a manner like that of units610, 612, and 614. The integer unit 610 is coupled an x86 EFLAGSregister 624. The EFLAGS register includes an X bit 625 whose state isset to indicate whether or not cryptographic operations are currently inprocess. In one embodiment the X bit 625 is bit 30 of an x86 ELFAGSregister 624. In addition, the integer unit 610 access a machinespecific register 628 to evaluate the state of an E bit 629. The stateof the E bit 629 indicates whether or not the cryptography unit 617 ispresent within the microprocessor 600. The integer unit 610 alsoaccesses a D bit 631 in a feature control register 630 to enable ordisable the cryptography unit 617. As with the microprocessor embodiment301 of FIG. 3, the microprocessor 600 of FIG. 6 features elementsessential to teach the present invention in the context of anx86-compatible embodiment and for clarity aggregates or omits otherelements of the microprocessor. One skilled in the art will appreciatethat other elements are required to complete the interface such as adata cache (not shown), bus interface unit (not shown), clock generationand distribution logic (not shown), etc.

In operation, instructions are fetched from memory (not shown) by thefetch logic 601 and are provided in synchronization with a clock signal(not shown) to the translation logic 602. The translation logic 602translates each instruction into a corresponding sequence of microinstructions that are sequentially provided in synchronization with theclock signal to subsequent stages 605-608, 618, 619 of themicroprocessor 600. Each micro instruction within a sequence of microinstructions directs execution of a sub-operation that is required toaccomplish an overall operation that is prescribed by a correspondinginstruction such as generation of an address by the address stage 606,addition of two operands within the integer unit 610 which have beenretrieved from prescribed registers (not shown) within the registerstage 605, storage of a result generated by one of the execution units610, 612, 614, 616, 617 in memory by the store logic 618, etc. Dependingupon the instruction that is being translated, the translation logic 602will employ the translator 603 to directly generate the sequence ofmicro instructions, or it will fetch the sequence from the microcode ROM604, or it will employ the translator 603 to directly generate a portionof the sequence and fetch the remaining portion of the sequence from themicrocode ROM 604. The micro instructions proceed sequentially throughthe successive stages 605-608, 618, 619 of the microprocessor 600 insynchronization with the clock. As micro instructions reach the executestage 608, they are routed by the execution logic 632 along with theiroperands (retrieved from registers within the register stage 605, orgenerated by logic within the address stage 606, or retrieved from adata cache by the load logic 608) to a designated execution unit 610,612, 614, 616, 617 by placing the micro instructions in a correspondingmicro instruction queue 609, 611, 613, 615. The execution units 610,612, 614, 616, 617 execute the micro instructions and provide results tothe store stage 618. In one embodiment, the micro instructions includefields indicating whether or not they can be executed in parallel withother operations.

Responsive to fetching an XCRYPT instruction as described above, thetranslation logic 602 generates associated micro instructions thatdirect logic within subsequent stages 605-608, 618, 619 of themicroprocessor 600 to perform the prescribed cryptographic operation.The particular construct of the associated micro instructions isdetermined in part by the value of a keygen field within a control word323 pointed to by contents of a control word register 308, as will befurther detailed below. For example, if the value of the keygen fieldspecifies that a user-generated key schedule is to be employed duringexecution of a prescribed cryptographic operation, then the keygen logic640 will construct the associated sequence of micro instructions todirect the microprocessor 600 to retrieve the user-generated keyschedule from the memory locations 324 pointed to by contents of the keypointer register 309, to load the user-generated key schedule into keyRAM within the cryptography unit 617 as will be further detailed below,and to employ the user-generated key schedule during execution of theprescribed cryptographic operation. If the value of the keygen fieldspecifies that a key schedule is to be automatically generated using acryptographic key that is provided, then the keygen logic 640 willconstruct the associated sequence of micro instructions to direct themicroprocessor 600 to retrieve the provided cryptographic key from thememory locations 324 pointed to by contents of the key pointer register309, to load the key into key RAM within the cryptography unit 617, toexpand the key into a key schedule, and to employ the expanded keyschedule during execution of the prescribed cryptographic operation. Thesize of the cryptographic key is programmed by establishing the value ofa keysize field within the control word. In one embodiment, values ofthe keysize field allow for prescription of a 128-bit cryptographic key,a 192-bit cryptographic key, and a 256-bit cryptographic key.

Accordingly, a first plurality of the associated micro instructions arerouted directly to the cryptography unit 617 and direct the unit 617 toload data provided over the load bus 620, or to load a block of inputdata and begin execution of a prescribed number of cryptographic roundsto produce a block of output data, or to provide a produced block ofoutput data over the store bus 622 for storage in memory by the storelogic 618. A second plurality of the associated micro instructions arerouted to other execution units 610, 612, 614, 616 to perform othersub-operations that are necessary to accomplish the prescribedcryptographic operation such as testing of the E bit 629, enabling the Dbit 631, setting the X bit 625 to indicate that a cryptographicoperation is in process, updating registers (e.g., count register, inputtext pointer register, output text pointer register) within the registerstage 605, processing of interrupts 627 indicated by the interrupt logic626, etc. The associated micro instructions are ordered to provide foroptimum performance of specified cryptographic operations on multipleblocks of input data by interlacing integer unit micro instructionswithin sequences of cryptography unit micro instructions so that integeroperations can be accomplished in parallel with cryptography unitoperations. Micro instructions are included in the associated microinstructions to allow for and recover from pending interrupts 627.Because all of the pointers to cryptographic parameters and data areprovided within x86 architectural registers, their states are saved wheninterrupts are processed and the states are restored upon return frominterrupts. Upon return from an interrupt, micro instructions test thestate of the X bit 625 to determine if a cryptographic operation was inprogress. If so, the operation is repeated on the particular block ofinput data that was being processed when the interrupt occurred. Theassociated micro instructions are ordered to allow for the pointerregisters and intermediate results of a sequence of block cryptographicoperations on a sequence of input text blocks to be updated prior toprocessing interrupts 627.

Now referring to FIG. 7, a diagram is presented illustrating fieldswithin an exemplary micro instruction 700 for directing cryptographicsub-operations within the microprocessor of FIG. 6. The microinstruction 700 includes a micro opcode field 701, a data register field702, and a register field 703. The micro opcode field 701 specifies aparticular sub-operation to be performed and designates logic within oneor more stages of the microprocessor 600 to perform the sub-operation.Specific values of the micro opcode field 701 designate that the microinstruction is directed for execution by a cryptography unit accordingto the present invention. In one embodiment, there are two specificvalues. A first value (XLOAD) designates that data is to be retrievedfrom a memory location whose address is specified by contents of anarchitectural register denoted by contents of the data register field702. The data is to be loaded into a register within the cryptographyunit that is specified by contents of the register field 703. Theretrieved data (e.g., cryptographic key data, control word, input textdata, initialization vector) is provided to the cryptography unit. Asecond value (XSTOR) of the micro opcode field 701 designates that datagenerated by the cryptography unit is to be stored in a memory locationwhose address is specified by contents of an architectural registerdenoted by contents of the data register field 702. In a multi-stageembodiment of the cryptography unit, contents of the register field 703prescribe one of a plurality of output data blocks for storage inmemory. The output data block is provided by the cryptography unit inthe data field 704 for access by store logic. More specific detailsconcerning XLOAD and XSTOR micro instructions for execution by acryptography unit according to the present invention will now bediscussed with reference to FIGS. 8 and 9.

Turning to FIG. 8, a table 800 is presented depicting values of theregister field 703 for an XLOAD micro instruction according to theformat 700 of FIG. 7. As was previously discussed, a sequence of microinstructions is generated in response to translation of an XCRPYTinstruction. The sequence of micro instructions comprises a firstplurality of micro instructions that are directed for execution by thecryptography unit and a second plurality of micro instructions that areexecuted by one or more of the parallel functional units within themicroprocessor other that the cryptography unit. The second plurality ofmicro instructions direct sub-operations such as updating of counters,temporary registers, architectural registers, testing and setting ofstatus bits in machine specific registers, and so on. The firstplurality of instructions provide key data, cryptographic parameters,and input data to the cryptography unit and direct the cryptography unitto generate key schedules (or to load key schedules that have beenretrieved from memory), to load and encrypt (or decrypt) input textdata, and to store output text data. An XLOAD micro instruction isprovided to the cryptography unit to load control word data, to load acryptographic key or key schedule, to load initialization vector data,to load input text data, and to load input text data and direct thecryptography unit to begin a prescribed cryptographic operation. Value0b010 in the register field 703 of an XLOAD micro instruction directsthe cryptography unit to load a control word into its internal controlword register. As this micro instruction proceeds down the pipeline, anarchitectural control word pointer register within the register stage isaccessed to obtain the address in memory where the control word isstored. Address logic translates the address into a physical address fora memory access. The load logic fetches the control word from cache andplaces the control word in the data field 704, which is then passed tothe cryptography unit. Likewise, register field value 0b100 directs thecryptography unit to load input text data provided in the data field 704and, following the load, to start the prescribed cryptographicoperation. Like the control word, the input data is accessed via apointer stored in an architectural register. Value 0b101 directs thatinput data provided in the data field 704 be loaded into internalregister 1 IN-1. Data loaded into IN-1 register can be either input textdata (when pipelining) or an initialization vector. Values 0b110 and0b111 direct the cryptography unit to load lower and upper bits,respectively, of a cryptographic key or one of the keys in auser-generated key schedule. According to the present application, auser is defined as that which performs a specified function or specifiedoperation. The user can embody an application program, an operatingsystem, a machine, or a person. Hence, the user-generated key schedule,in one embodiment, is generated by an application program. In analternative embodiment, the user-generated key schedule is generated bya person.

In one embodiment, register field values 0b100 and 0b101 contemplate acryptography unit that has two stages, whereby successive blocks ofinput text data can be pipelined. Hence, to pipeline two successiveblocks of input data, a first XLOAD micro instruction is executed thatprovides a first block of input text data to IN-1 followed by executionof a second XLOAD micro instruction that provides a second block ofinput text data to IN-0 and that also directs the cryptography unit tobegin performing the prescribed cryptographic operation.

If a user-generated key schedule is employed to perform thecryptographic operation, then a number of XLOAD micro instructions thatcorrespond to the number of keys within the user-generated key scheduleare routed to the cryptography unit that direct the unit to load eachround key within the key schedule.

All other values of the register field 703 in an XLOAD micro instructionare reserved.

Referring to FIG. 9, a table 900 is presented showing values of theregister field 703 for an XSTOR micro instruction according to theformat 700 of FIG. 7. An XSTOR micro instruction is issued to thecryptography unit to direct it to provide a generated (i.e., encryptedor decrypted) output text block to store logic for storage in memory atthe address provided in the address field 702. Accordingly, translationlogic according to the present invention issues an XSTOR microinstruction for a particular output text block following issuance of anXLOAD micro instruction for its corresponding input text block. Value0b100 of the register field 703 directs the cryptography unit to providethe output text block associated with its internal output-0 OUT-0register to store logic for storage. Contents of OUT-0 are associatedwith the input text block provided to IN-0. Likewise, contents ofinternal output-1 register, referenced by register field value 0b101,are associated with the input text data provided to IN-1. Accordingly,following loading of keys and control word data, a plurality of inputtext blocks can be pipelined through the cryptography unit by issuingcryptographic micro instructions in the order XLOAD.IN-1, XLOAD.IN-0(XLOAD.IN-0 directs the cryptography unit to start the cryptographicoperation as well), XSTOR.OUT-1, XSTOR.OUT-0, XLOAD.IN-1, XLOAD.IN-0(starts the operation for the next two input text blocks), and so on.

Now turning to FIG. 10, a diagram is provided highlighting an exemplarycontrol word format 1000 for prescribing cryptographic parameters of acryptographic operation according to the present invention. The controlword 1000 is programmed into memory by a user and its pointer isprovided to an architectural register within a conforming microprocessorprior to performing cryptographic operations. Accordingly, as part of asequence of micro instructions corresponding to a provided XCRYPTinstruction, an XLOAD micro instruction is issued directing themicroprocessor to read the architectural register containing thepointer, to convert the pointer into a physical memory address, toretrieve the control word 1000 from memory (cache), and to load thecontrol word 1000 into the cryptography unit's internal control wordregister. The control word 1000 includes a reserved RSVD field 1001, adata block size field 1002, a key size KSIZE field 1003, anencryption/decryption E/D field 1004, an intermediate result IRSLT field1005, a key generation KGEN field 1006, an algorithm ALG field 1007, anda round count RCNT field 1008.

All values for the reserved field 1001 are reserved. Contents of theDSIZE field 1002 prescribe the input and output text block size to beemployed when performing encryption and decryption. In one embodiment,the DSIZE field 1002 prescribes either 128-bit blocks, 192-bit blocks,or 256-bit blocks. Contents of the KSIZE field 1003 prescribe the sizeof a cryptographic key that is to be employed to accomplish encryptionor decryption. In one embodiment, the KSIZE field 1003 prescribes eithera 128-bit key, a 192-bit key, or a 256-bit key. The E/D field 1004specifies whether the cryptographic operation is to be an encryptionoperation or a decryption operation. The KGEN field 1006 indicates if auser-generated key schedule is provided in memory or if a singlecryptographic key is provided in memory. If a single cryptographic keyis provided, then micro instructions are issued to the cryptography unitalong with the cryptographic key directing the unit to expand the keyinto a key schedule according to the cryptographic algorithm that isspecified by contents of the ALG field 1007. In one embodiment, specificvalues of the ALG field 1007 specifies the DES algorithm, the Triple-DESalgorithm, or the AES algorithm as has heretofore been discussed.Alternative embodiments contemplate other cryptographic algorithms suchas the Rijndael Cipher, the Twofish Cipher, etc. Contents of the RCNTfield 1008 prescribe the number of cryptographic rounds that are to beaccomplished on each block of input text according to the specifiedalgorithm. Although the standards for the above-noted algorithmsprescribed a fixed number of cryptographic rounds per input text block,provision of the RCNT field 1008 allows a programmer to vary the numberof rounds from that specified by the standards. In one embodiment, theprogrammer can specify from 0 to 15 rounds per block. Finally, contentsof the IRSLT field 1005 specify whether encryption/decryption of aninput text block is to be performed for the number of rounds specifiedin RCNT 1008 according to the standard for the cryptographic algorithmspecified in ALG 1007 or whether the encryption/decryption is to beperformed for the number of rounds specified in RCNT 1008 where thefinal round performed represents an intermediate result rather than afinal result according to the algorithm specified in ALG 1007. Oneskilled in the art will appreciate that many cryptographic algorithmsperform the same sub-operations during each round, except for thoseperformed in the final round. Hence, programming the IRSLT field 1005 toprovide intermediate results rather than final results allows aprogrammer to verify intermediate steps of the implemented algorithm.For example, incremental intermediate results to verify algorithmperformance can be obtained by, say, performing one round of encryptionon a text block, then performing two rounds on the same text block, thenthree round, and so on. The capability to provide programmable roundsand intermediate results enables users to verify cryptographicperformance, to troubleshoot, and to research the utility of varying keystructures and round counts.

Turning now to FIG. 11, a table 1100 is presented illustrating exemplaryvalues of the KGEN field 1006 for the control word 1000 of FIG. 10. A“0” value of the KGEN field 1006 directs a computing device according tothe present invention to automatically generate a key schedule for aprescribed cryptographic operation from a cryptographic key that isprovided in memory and which is pointed to by contents of a key pointerregister. Automatic key schedule generation is equivalent to keyexpansion according to certain cryptographic algorithms such as AES. A“1” value of the KGEN field 1006 indicates that a user-generated keyschedule for a prescribed cryptographic operation is provided in memoryand is pointed to by contents of a key pointer register. Rather thatexpanding a cryptographic key schedule, a computing device according tothe present invention will load the user-generated key schedule frommemory and will employ it during execution of the prescribedcryptographic operation. One advantage of the present invention is thata user can employ a key schedule for cryptographic round operations thatdoes not comport with the particular cryptographic algorithm that isbeing utilized.

Now referring to FIG. 12, a block diagram is presented featuring detailsof an exemplary cryptography unit 1200 according to the presentinvention. The cryptography unit 1200 includes a micro opcode register1203 that receives cryptographic micro instructions (i.e., XLOAD andXSTOR micro instructions) via a micro instruction bus 1214. Thecryptography unit 1200 also has a control word register 1204, an input-0register 1205, and input-1 register 1206, a key-0 register 1207, and akey-1 register 1208. Data is provided to registers 1204-1208 via a loadbus 1211 as prescribed by contents of an XLOAD micro instruction withinthe micro instruction register 1203. The cryptography unit 1200 alsoincludes block cipher logic 1201 that is coupled to all of the registers1203-1208 and that is also coupled to cryptographic key RAM 1202. Theblock cipher logic 1201 includes key expansion logic 1220. The blockcipher logic 1201 also provides a stall signal 1213 and provides blockresults to an output-0 register 1209 and an output-1 register 1210. Theoutput registers 1209-1210 route their contents to successive stages ina conforming microprocessor via a store bus 1212. In one embodiment, themicro instruction register 1203 is 32 bits in size; registers 1204,1207, and 1208 are 128-bits in size; and registers 1205-1206 and1209-1210 are 256-bits in size.

Operationally, cryptographic micro instructions are providedsequentially to the micro instruction register 1203 along with data thatis designated for the control word register 1204, or one of the inputregisters 1205-1206, or one of the key registers 1207-1208. In theembodiment discussed with reference to FIGS. 8 and 9, a control word isloaded via an XLOAD micro instruction to the control word register 1204.Then the cryptographic key or key schedule is loaded via successiveXLOAD micro instructions. If a 128-bit cryptographic key is to beloaded, then an XLOAD micro instruction is provided designating registerKEY-0 1207. If a cryptographic key greater than 128 bits is to beloaded, then an XLOAD micro instruction designating register KEY-0 1207is provided along with an XLOAD micro instruction designating registerKEY-1 1208. If a user-generated key schedule is to be loaded, thensuccessive XLOAD micro instructions designating register KEY-0 1207 areprovided. Each of the keys from the key schedule that are loaded areplaced, in order, in the key RAM 1202 for use during their correspondingcryptographic round. Following this, input text data (if aninitialization vector is not required) is loaded to IN-1 register 1206.If an initialization vector is required, then it is loaded into IN-1register 1206 via an XLOAD micro instruction. An XLOAD micro instructionto IN-0 register 1205 directs the cryptography unit to load input textdata to IN-0 register 1205 and to begin performing cryptographic roundson input text data in register IN-0 1205 using the initialization vectorin IN-1 or in both input registers 1205-1206 (if input data is beingpipelined) according to the parameters provided via contents of thecontrol word register 1204. Upon receipt of an XLOAD micro instructiondesignating IN-0 1205, the block cipher logic 1201 starts performing thecryptographic operation prescribed by contents of the control word. Ifexpansion of a single cryptographic key is required, then the keyexpansion logic 1220 expands the cryptographic key provided via theXLOAD instructions to registers KEY-0 1207 and KEY-1 1208 according tothe specified cryptographic algorithm to generate each of the keys inthe key schedule. As they are generated, the keys are stored in the keyRAM 1202. Regardless of whether the key expansion logic 1220 generates akey schedule or whether the key schedule is loaded from memory, the keyfor the first round is cached within the block cipher logic 1201 so thatthe first block cryptographic round can proceed without having to accessthe key RAM 1202. Once initiated, the block cipher logic 1201 continuesexecuting the prescribed cryptographic operation on one or more blocksof input text until the operation is completed, successively fetchinground keys from the key RAM 1202 as required by the cryptographicalgorithm which is employed. The cryptography unit 1200 performs aspecified block cryptographic operation on designated blocks of inputtext. Successive blocks of input text are encrypted or decrypted throughthe execution of corresponding successive XLOAD and XSTOR microinstructions. When an XSTOR micro instruction is executed, if theprescribed output data (i.e., OUT-0 or OUT-1) has not yet completedgeneration, then the block cipher logic 1201 asserts the stall signal1213. Once the output data has been generated and placed into acorresponding output register 1209-1210, then the contents of thatregister 1209-1210 are transferred to the store bus 1212.

Now turning to FIG. 13, a block diagram is provided illustrating anexemplary embodiment of block cipher logic 1300 according to the presentinvention for performing cryptographic operations in accordance with theAdvanced Encryption Standard (AES). The block cipher logic 1300 includesa round engine 1320 that is coupled to a round engine controller 1310via buses 1311-1314, buses 1316-1318, and bus RNDKEY 1332. The roundengine controller 1310 includes a key size controller 1330 and accessesa micro instruction register 1301, control word register 1302, KEY-0register 1303, and KEY-1 register 1304 to access key data, microinstructions, and parameters of the directed cryptographic operation.Contents of input registers 1305-1306 are provided to the round engine1320 and the round engine 1320 provides corresponding output text tooutput registers 1307-1308. The output registers 1307-1308 are alsocoupled to the round engine controller 1310 via buses 1316-1317 toenable the round engine controller access to the results of eachsuccessive cryptographic round, which is provided to the round engine1320 for a next cryptographic round via bus NEXTIN 1318. Cryptographickeys from key RAM (not shown) are accessed via bus 1315. Signal ENC/DEC1311 directs the round engine to employ sub-operations for performingeither encryption (e.g., S-Box) or decryption (e.g., Inverse S-Box).Contents of bus RNDCON 1312 direct the round engine 1320 to performeither a first AES round, an intermediate AES round, or a final AESround. Responsive to contents of a KSIZE field within a control wordthat prescribes the size of the cryptographic key to be employed, thekey size controller 1330 specifies the size of the cryptographic key viabus KEYSIZE 1319. If the key schedule is to be automatically generated,then the round engine controller 1310 asserts signal GENKEY 1314 todirect key expansion logic 1331 within the round engine 1320 to generatea key schedule using the key provided via bus 1313 and of size specifiedby KEYSIZE 1319. Responsive to signal GENKEY 1314, the key expansionlogic 1331 provides the generated key schedule to the round enginecontroller 1310 via bus RNDKEY 1332. The generated round keys are thusprovided to key RAM via bus 1315. Key bus 1313 is also employed toprovide each round key to the round engine 1320 when its correspondinground is executed. In one embodiment, the value of bus KEYSIZE 1319indicates a 128-bit key, a 192-bit key, or a 256-bit key.

The round engine 1320 includes first key XOR logic 1321 that is coupledto a first register REG-0 1322. The first register 1322 is coupled toS-Box logic 1323, which is coupled to Shift Row logic 1324. The ShiftRow logic 1324 is coupled to a second register REG-1 1325. The secondregister 1325 is coupled to Mix Column logic 1326, which is coupled to athird register REG-2 1327. The first key logic 1321, S-Box logic 1323,Shift Row logic 1324, and Mix Column logic 1326 are configured toperform like-named sub-operations on input text data as is specified inthe AES FIPS standard discussed above. The Mix Columns logic 1326 isadditionally configured to perform AES XOR functions on input dataduring intermediate rounds as required using round keys provided via thekey bus 1313. The first key logic 1321, S-Box logic 1323, Shift Rowlogic 1324, and Mix Column logic 1326 are also configured to performtheir corresponding inverse AES sub-operations during decryption asdirected via the state of ENC/DEC 1311. One skilled in the art willappreciate that intermediate round data is fed back to the round engine1320 according to which particular block encryption mode is prescribedvia contents of the control word register 1302. Initialization vectordata (if required) is provided to the round engine 1320 via bus NEXTIN1318.

In the embodiment shown in FIG. 13, the round engine is divided into twostages: a first stage between REG-0 1322 and REG-1 1325 and a secondstage between REG-1 1325 and REG-2 1327. Intermediate round data ispipelined between stages in synchronization with a clock signal (notshown). When a cryptographic operation is completed on a block of inputdata, the associated output data is placed into a corresponding outputregister 1307-1308. Execution of an XSTOR micro instruction causescontents of a designated output register 1307-1308 to be provided to astore bus (not shown).

Referring to FIG. 14, a block diagram is presented illustrating detailsof exemplary 128-bit key expansion logic 1400 according to the presentinvention that is configured to expand a cryptographic key into acorresponding key schedule. For purposes of teaching the presentinvention, the key expansion logic 1400 is described and illustrated interms of the AES algorithm, although the present inventors note thatsuch details are presented for clarity of presentation and should not beemployed to limit the scope of the present invention. The key expansionlogic 1400 includes a key buffer 1401 that is coupled to a first 128-bitregister 1402. An initial cryptographic key is received from a roundengine controller 1310 according to the present invention via busGENKEY. Bits 127:96 from the first register 1402 are provided to S-BoxLogic 1403 and to a 32-bit XOR gate 1404. Bits 95:64 of the firstregister 1402 are provided to 32-bit XOR gate 1405. The output of XORgate 1405 is coupled to XOR gate 1404. Bits 63:32 of the first register1402 are coupled to a 32-bit XOR gate 1406. The output of XOR gate 1406is coupled to XOR gate 1405. Bits 31:0 of the first register 1402 arecoupled to XOR gate 1406. The key expansion logic 1400 also includes asecond register 1407 having five 32-bit fields for receiving 32-bitinputs from the S-Box Logic 1403, XOR gates 1404-1406, and from bits31:0 of the first register 1402. The five 32-bit fields of the secondregister 1407 are provided to Round Constant (RCON) Logic 1408, and tofour 32-bit XOR gates 1409-1412. The output of the RCON logic 1408 isalso provided to the XOR gates 1409-1412. XOR gates 1409-1412 provide32-bit outputs to four fields of a third register 1413. All four 32-bitfields of the third register 1413 are provided to a 128-bit round keybuffer 1414 and are also fed back to the first register 1402 via bus1415. The output of the round key buffer 1414 (i.e., a generated roundkey within an expanded key schedule) is provided to a round enginecontroller according to the present invention via bus 1416.

In operation, the cryptographic key to be expanded is provided to thekey buffer 1401 from the round engine controller 1310 via bus GENKEY andexpansion of the key is executed in synchronization with a clock signal(not shown). A round manager 1417 detects provision of the key viaGENKEY and iteratively issues a round number for key expansion to theRCON logic 1408 via bus RNDNUM. Accordingly, the contents of the keybuffer 1401 are transferred to the first register 1402. In addition,RNDNUM is set to indicate that a round key is to be generated for aninitial AES round. According to the AES key expansion specifications,bits 127:96 of the cryptographic key are provided to the S-box logic1403, the output of which is provided to the RCON logic 1408 via thesecond register 1407. In accordance with the value or RNDNUM, the RCONlogic 1408 outputs a 32-bit round constant, which is provided to each offour 32-bit XOR gates 1409-1412. Accordingly, bits 31:0 of the initialround key are generated as the XOR of the initial round constantprovided via the RCON logic 1408 with bits 31:0 of the cryptographickey. Bits 63:32 of the initial round key are generated as the XOR of theinitial round constant with bits 63:32 of a first term which is the XORof the lower two doublewords of the cryptographic key. Bits 95:64 of theinitial round key are generated as the XOR of the initial round constantwith bits 95:64 of a second term which is the XOR of the first term andbits 95:64 of the cryptographic key. Bits 127:96 of the initial roundkey are generated as the XOR of the initial round constant with bits127:96 of a third term which is the XOR of the second term and bits127:96 of the cryptographic key.

The initial round key is output to the round key buffer 1414 andsubsequently to the round engine controller 1310 (which provides it tothe Key RAM) and is also fed back to the first register 1402 for use ingenerating a next round key. In addition, the RND MGR logic 1417increments the value of the RNDNUM bus.

The next round key, and all subsequent round keys, are generatediteratively in the manner as described above until all keys for theexpanded key schedule have been generated.

Now turning to FIG. 15, a flow chart is presented featuring a methodaccording to the present invention for preserving the state ofcryptographic parameters during an interrupting event. Flow begins atblock 1502 when a flow of instructions is executed by a microprocessoraccording to the present invention. It is not necessary that the flow ofinstructions include an XCRYPT instruction as is herein described. Flowthen proceeds to decision block 1504.

At decision block 1504, an evaluation is made to determine if aninterrupting event (e.g., maskable interrupt, non-maskable interrupt,page fault, task switch, etc.) is occurring that requires a change inthe flow of instructions over to a flow of instructions (“interrupthandler”) to process the interrupting event. If so, then flow proceedsto block 1506. If not, then flow loops on decision block 1504 whereinstruction execution continues until an interrupting event occurs.

At block 1506, because an interrupting event has occurred, prior totransferring program control to a corresponding interrupt handler,interrupt logic according to the present invention directs that the Xbit within a flags register be cleared. Clearing of the X bit ensuresthat, upon return from the interrupt handler, if a block cryptographicoperation was in progress, it will be indicated that one or moreinterrupting events transpired and that control word data and key datamust be reloaded prior to continuing the block cryptographic operationon the block of input data currently pointed to by contents of the inputpointer register. Flow then proceeds to block 1508.

At block 1508, all of the architectural registers containing pointersand counters associated with performance of a block cryptographicoperation according to the present invention are saved to memory. Oneskilled in the art will appreciate that the saving of architecturalregisters is an activity that is typically accomplished in a presentdata computing device prior to transferring control to interrupthandlers. Consequently, the present invention exploits this aspect ofpresent data architectures to provide for transparency of executionthroughout interrupting events. After the registers are saved, flow thenproceeds to block 1510.

At block 1510, program flow is transferred to the interrupt handler.Flow then proceeds to block 1512.

At block 1512, the method completes. One skilled in the art willappreciate that the method of FIG. 15 begins again at block 1502 uponreturn from the interrupt handler.

Now referring to FIG. 16, a flow chart 1600 is provided depicting amethod according to the present invention for expanding a providedcryptographic key into a corresponding key schedule to perform aspecified cryptographic operation on a plurality of input data blocks inthe presence of one or more interrupting events. For purposes ofclarity, flow for executing the specified cryptographic operationsaccording to block cipher modes that require update and storage ofinitialization vector equivalents between blocks (e.g., output feedbackmode, cipher feedback mode) is omitted, although these other blockcipher modes are comprehended by the method according to the presentinvention.

Flow begins at block 1602, where an XCRPYT instruction according to thepresent invention that directs a cryptographic operation beginsexecution. Execution of the XCRYPT instruction can be a first executionor it can be execution following a first execution as a result ofinterruption of execution by an interrupting event such that programcontrol is transferred back to the XCRYPT instruction after an interrupthandler has executed. Flow then proceeds to block 1604.

At block 1604, a block of data in memory that is pointed to by contentsof an input pointer register according to the present invention isloaded from the memory and a prescribed cryptographic operation isstarted. In one embodiment, the prescribed cryptographic operation isstarted according to the AES algorithm. Flow then proceeds to decisionblock 1606.

At decision block 1606, an evaluation is made to determine whether ornot an X bit in a flags register is set. If the X bit is set, then it isindicated that the control word and key schedule currently loaded withina cryptography unit according to the present invention are valid. If theX bit is clear, then it is indicated that the control word and keyschedule currently loaded within the cryptography unit are not valid. Asalluded to above with reference to FIG. 15, the X bit is cleared when aninterrupting event occurs. In addition, as noted above, when it isnecessary to load a new control word or key schedule or both, it isrequired that instructions be executed to clear the X bit prior toissuing the XCRYPT instruction. In an X86-compatible embodiment thatemploys bit 30 within an X86 EFLAGS register, the X bit can be clearedby executing a PUSHFD instruction followed by a POPFD instruction. Oneskilled in the art will appreciate, however, that in alternativeembodiments other instructions must be employed to clear the X bit. Ifthe X bit is set, then flow proceeds to block 1620. IF the X bit isclear, then flow proceeds to block 1608.

At block 1608, since a cleared X bit has indicated that either aninterrupting event has occurred or that a new control word and/or keydata are to be loaded, a control word is loaded from memory. In oneembodiment, loading the control word stops the cryptography unit fromperforming the prescribed cryptographic operation noted above withreference to block 1604. Starting a cryptographic operation in block1604 in this exemplary embodiment allows for optimization of multipleblock cryptographic operations using ECB mode by presuming that acurrently loaded control word and key data are to be employed and thatECB mode is the most commonly employed block cipher mode. Accordingly,the current block of input data is loaded and the cryptographicoperation begun prior to checking the state of the X bit in decisionblock 1606 is reset. Flow then proceeds to decision block 1610.

At decision block 1610, the keygen field within the control wordretrieved at block 1608 is evaluated to determine whether auser-generated key schedule is provided in memory or if a cryptographickey is provided in memory and it is required to expand the cryptographickey into a key schedule. If the value of the kgen field prescribesautomatic key expansion, then flow proceeds to block 1612. If the valueof the kgen field prescribes that a user-generated key schedule isprovided, then flow proceeds to block 1616.

At block 1612, the cryptographic key is loaded from memory. Flow thenproceeds to block 1614.

At block 1614, the cryptographic key is expanded into a key schedulecommensurate with the cryptographic algorithm being employed, and thekey schedule is loaded into key RAM for employment during execution ofthe cryptographic operation. Flow then proceeds to block 1618.

At block 1616, a user-generated cryptographic key schedule is retrievedfrom memory and loaded into key RAM for employment during execution ofthe cryptographic operation. Flow then proceeds to block 1618.

At block 1618, the input block referenced in block 1604 is loaded againand the cryptographic operation is started according to the newly loadedcontrol word and key schedule. Flow then proceeds to block 1620.

At block 1620, an output block corresponding to the loaded input blockis generated. For encryption, the input block is a plaintext block andthe output block is a corresponding ciphertext block. For decryption,the input block is a ciphertext block and the output block is acorresponding plaintext block. Flow then proceeds to block 1622.

At block 1622, the generated output block is stored to memory. Flow thenproceeds to block 1624.

At block 1624, the contents of input and output block pointer registersare modified to point to next input and output data blocks. In addition,contents of the block counter register are modified to indicatecompletion of the cryptographic operation on the current input datablock. In the embodiment discussed with reference to FIG. 16, the blockcounter register is decremented. One skilled in the art will appreciate,however, that alternative embodiments contemplate manipulation andtesting of contents of the block count register to allow for pipelinedexecution of input text blocks as well. Flow then proceeds to decisionblock 1626.

At decision block 1626, an evaluation is made to determine if an inputdata block remains to be operated upon. In the embodiment featuredherein, for illustrative purposes, the block counter is evaluated todetermine if it equals zero. If no block remains to be operated upon,then flow proceeds to block 1630. If a block remains to be operatedupon, then flow proceeds to block 1628.

At block 1628, the next block of input data is loaded, as pointed to bycontents of the input pointer register. Flow then proceeds to block1620.

At block 1630, the method completes.

Although the present invention and its objects, features, and advantageshave been described in detail, other embodiments are encompassed by theinvention as well. For example, the present invention has been discussedat length according to embodiments that are compatible with the x86architecture. However, the discussions have been provided in such amanner because the x86 architecture is widely comprehended and thusprovides a sufficient vehicle to teach the present invention. Thepresent invention nevertheless comprehends embodiments that comport withother instruction set architectures such as PowerPC®, MIPS®, and thelike, in addition to entirely new instruction set architectures.

The present invention moreover comprehends execution of cryptographicoperations within elements of a computing system other than themicroprocessor itself. For example, the cryptographic instructionaccording to the present invention could easily be applied within anembodiment of a cryptography unit that is not part of the sameintegrated circuit as a microprocessor that exercises as part of thecomputer system. It is anticipated that such embodiments of the presentinvention are in order for incorporation into a chipset surrounding amicroprocessor (e.g., north bridge, south bridge) or as a processordedicated for performing cryptographic operations where thecryptographic instruction is handed off to the processor from a hostmicroprocessor. It is contemplated that the present invention applies toembedded controllers, industrial controllers, signal processors, arrayprocessors, and any like devices that are employed to process data. Thepresent invention also comprehends an embodiment comprising only thoseelements essential to performing cryptographic operations as describedherein. A device embodied as such would indeed provide a low-cost,low-power alternative for performing cryptographic operations only, say,as an encryption/decryption processor within a communications system.For clarity, the present inventors refer to these alternative processingelements as noted above as processors.

In addition, although the present invention has been described in termsof 128-bit blocks, it is considered that various different block sizescan be employed by merely changing the size of registers that carryinput data, output data, keys, and control words.

Furthermore, although DES, Triple-DES, and AES have been prominentlyfeatured in this application, the present inventors note that theinvention described herein encompasses lesser known block cryptographyalgorithms as well such as the MARS cipher, the Rijndael cipher, theTwofish cipher, the Blowfish Cipher, the Serpent Cipher, and the RC6cipher. What is sufficient to comprehend is that the present inventionprovides dedicated block cryptography apparatus and supportingmethodology within a microprocessor where atomic block cryptographicoperations can be invoked via execution of a single instruction.

Also, although the present invention has been featured herein in termsof block cryptographic algorithms and associated techniques forperforming block cryptographic functions, it is noted that the presentinvention entirely comprehends other forms of cryptography other thanblock cryptography. It is sufficient to observe that a singleinstruction is provided whereby a user can direct a conformingmicroprocessor to perform a cryptographic operation such as encryptionor decryption, where the microprocessor includes a dedicatedcryptography unit that is directed towards accomplishment ofcryptographic functions prescribed by the instruction.

Moreover, the discussion of a round engine herein provides for a 2-stageapparatus that can pipeline two blocks of input data, the presentinventors note that additional embodiments contemplate more than twostages. It is anticipated that stage division to support pipelining ofmore input data blocks will evolve in concert with dividing of otherstages within a comporting microprocessor.

Finally, although the present invention has been specifically discussedas a single cryptography unit that supports a plurality of blockcryptographic algorithms, the invention also comprehends provision ofmultiple cryptographic units operatively coupled in parallel with otherexecution units in a conforming microprocessor where each of themultiple cryptographic units is configured to perform a specific blockcryptographic algorithm. For example, a first unit is configured forAES, a second for DES, and so on.

Those skilled in the art should appreciate that they can readily use thedisclosed conception and specific embodiments as a basis for designingor modifying other structures for carrying out the same purposes of thepresent invention, and that various changes, substitutions andalterations can be made herein without departing from the spirit andscope of the invention as defined by the appended claims.

1. An apparatus for performing cryptographic operations, comprising: anx86-compatible microprocessor; a control word, configured to prescribethat a provided cryptographic key be expanded into a corresponding keyschedule for employment during execution of one of the cryptographicoperations, wherein said control word is stored in memory, and wherein amemory location of said control word is prescribed by contents of aregister that is referenced by a single atomic cryptographicinstruction, wherein said single atomic cryptographic instruction isarranged according to the instruction format for execution on saidx86-compatible microprocessor; fetch logic, disposed within saidx86-compatible microprocessor, configured to receive said single atomiccryptographic instruction as part of an instruction flow executing onsaid x86-compatible microprocessor, wherein said single atomiccryptographic instruction prescribes said one of the cryptographicoperations, and wherein said single atomic cryptographic instructionreferences said control word; translation logic, coupled to said fetchlogic, configured to translate said single atomic cryptographicinstruction into a sequence of micro instructions that directs saidx86-compatible microprocessor to perform said one of the cryptographicoperations; keygen logic, disposed within said x86-compatiblemicroprocessor and operatively coupled to said single atomiccryptographic instruction, configured to direct said x86-compatiblemicroprocessor to expand said provided cryptographic key into saidcorresponding key schedule; and execution logic, disposed within saidx86-compatible microprocessor and operatively coupled to said keygenlogic, configured to expand said provided cryptographic key into saidcorresponding key schedule, said execution logic comprising: acryptography unit, configured to execute a plurality of cryptographicrounds on each of a plurality of input text blocks to generate acorresponding each of a plurality of output text blocks, wherein saidplurality of cryptographic rounds are prescribed by said control word.2. The apparatus as recited in claim 1, wherein said one of thecryptographic operations further comprises: an encryption operation,said encryption operation comprising encryption of a plurality ofplaintext blocks to generate a corresponding plurality of ciphertextblocks.
 3. The apparatus as recited in claim 1, wherein said one of thecryptographic operations further comprises: a decryption operation, saiddecryption operation comprising decryption of a plurality of ciphertextblocks to generate a corresponding plurality of plaintext blocks.
 4. Theapparatus as recited in claim 1, wherein said provided cryptographic keyis stored in memory.
 5. The apparatus as recited in claim 1, whereinsaid corresponding key schedule comprises an expanded key scheduleaccording to the Advanced Encryption Standard (AES) algorithm.
 6. Theapparatus as recited in claim 1, wherein said keygen logic is configuredto interpret a key generation field within said control word which isreferenced by said single atomic cryptographic instruction.
 7. Theapparatus as recited in claim 1, wherein said single atomiccryptographic instruction implicitly references a plurality of registerswithin said x86-compatible microprocessor.
 8. The apparatus as recitedin claim 7, wherein said plurality of registers comprises: a firstregister, wherein contents of said first register comprise a firstpointer to a first memory address, said first memory address specifyinga first location in memory for access of said plurality of input textblocks upon which said one of the cryptographic operations is to beaccomplished.
 9. The apparatus as recited in claim 7, wherein saidplurality of registers comprises: a first register, wherein contents ofsaid first register comprise a first pointer to a first memory address,said first memory address specifying a first location in memory forstorage of said corresponding plurality of output text blocks.
 10. Theapparatus as recited in claim 7, wherein said plurality of registerscomprises: a first register, wherein contents of said first registerindicate a number of text blocks within said plurality of input textblocks.
 11. The apparatus as recited in claim 7, wherein said pluralityof registers comprises: a first register, wherein contents of said firstregister comprise a first pointer to a first memory address, said firstmemory address specifying a first location in memory for access ofcryptographic key data for use in accomplishing said one of thecryptographic operations.
 12. The apparatus as recited in claim 11,wherein said cryptographic key data comprises said providedcryptographic key.
 13. The apparatus as recited in claim 7, wherein saidplurality of registers comprises: a first register, wherein contents ofsaid first register comprise a first pointer to a first memory address,said first memory address specifying a first location in memory, saidfirst location comprising an initialization vector location, contents ofsaid initialization vector location comprising an initialization vectoror initialization vector equivalent for use in accomplishing said one ofthe cryptographic operations.
 14. The apparatus as recited in claim 7,wherein said plurality of registers comprises: a first register, whereincontents of said first register comprise a first pointer to a firstmemory address, said first memory address specifying a first location inmemory for access of said control word for use in accomplishing said oneof the cryptographic operations, wherein said control word prescribescryptographic parameters for said one of the cryptographic operations,and wherein said control word comprises: a keygen field, configured tospecify that said provided cryptographic key be expanded into saidcorresponding key schedule.
 15. An apparatus for performingcryptographic operations, comprising: an x86-compatible microprocessor;a control word, configured to prescribe that a cryptographic key beexpanded into a corresponding key schedule for employment when executingone of the cryptographic operations, wherein said control word is storedin memory, and wherein a memory location of said control word isprescribed by contents of a register that is referenced by a singleatomic cryptographic instruction, wherein said single atomiccryptographic instruction is arranged according to the instructionformat for execution on said x86-compatible microprocessor; acryptography unit disposed within execution logic in said x86-compatiblemicroprocessor, configured to execute said one of the cryptographicoperations responsive to receipt by said x86-compatible microprocessorof said single atomic cryptographic instruction within an instructionflow that prescribes said one of the cryptographic operations, whereinsaid single atomic cryptographic instruction is fetched from memory byfetch logic in said x86-compatible microprocessor, and whereintranslation logic in said x86-compatible microprocessor translates saidsingle atomic cryptographic instruction into a sequence of microinstructions that directs said x86-compatible microprocessor to performsaid one of the cryptographic operations; and keygen logic, operativelycoupled to said cryptography unit, configured to direct saidx86-compatible microprocessor to perform said one of the cryptographicoperations and to expand said cryptographic key into said correspondingkey schedule.
 16. The apparatus as recited in claim 15, wherein saidcryptographic key is stored in memory.
 17. The apparatus as recited inclaim 15, wherein said corresponding key schedule comprises an expandedkey schedule according to the Advanced Encryption Standard (AES)algorithm.
 18. The apparatus as recited in claim 15, wherein said keygenlogic is configured to interpret a key generation field within saidcontrol word which is referenced by said single atomic cryptographicinstruction.
 19. A method for performing cryptographic operations, themethod comprising: via fetch logic disposed within an x86-compatiblemicroprocessor, fetching a single atomic cryptographic instruction frommemory that prescribes one of a plurality of cryptographic operations,and via translation logic disposed within the x86-compatiblemicroprocessor, translating the single atomic cryptographic instructioninto a sequence of micro instructions that direct the x86-compatiblemicroprocessor to perform the one of the plurality of cryptographicoperations, wherein the single atomic cryptographic instruction isarranged according to the instruction format for execution on thex86-compatible microprocessor; via a field within a control word that isreferenced by the single atomic cryptographic instruction, specifyingexpansion of a cryptographic key into a corresponding key schedule foremployment during execution of the one of a plurality of cryptographicoperations; and via a cryptography unit disposed within execution logicin the x86-compatible microprocessor, expanding the cryptographic keyinto the corresponding key schedule.
 20. The method as recited in claim19, wherein said expanding comprises: loading the cryptographic key frommemory.
 21. The method as recited in claim 19, wherein the correspondingkey schedule comprises an expanded key schedule according to theAdvanced Encryption Standard (AES) algorithm.